using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public class AdminSessionHelper
    {
        private static string userDetails = "adminUserDetails"; //user details state
        public static DataRow UserDetails
        {
            get
            {
                return (DataRow)HttpContext.Current.Session[userDetails];
            }
            set
            {
                HttpContext.Current.Session[userDetails] = value;
            }
        }

      
        //Check is any session alive
        public static bool IsAnySessionAlive()
        {
            foreach (string strKey in HttpContext.Current.Session.Keys)
            {
                if (HttpContext.Current.Session[strKey] != "")
                    return true;
            }
            return false;
        }

        public static void Remove(string str)
        {
            HttpContext.Current.Session.Remove(str);
        }

        public static void chkValidVisit()
        { 
            if(UserDetails==null)
                HttpContext.Current.Response.Redirect(ConfigHelper.AdminLoginPage);
        }
       
    }

